<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ include file="/include/header.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><s:i18n name="menus"><s:text name="addFareAlertSetting"></s:text></s:i18n></title>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script>
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/show.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script>
<link href="<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/fare/js/cityquery/citylist.js" type="text/javascript"></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>
<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/wait/js/wait.js"></script>
<!-- 圆角文本框 -->
<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
		$(function(){
	            $("#navtab1").ligerTab();
	           // alert(window.dialogArguments);
	           // window.dialogArguments.showhaha();
	       });	


</script>

</head>

<body>
	<div id="navtab1" style="text-align:center; overflow: hidden; border: 1px solid #A3C0E8;">
		<div tabid="home" title="<s:i18n name='forms'><s:text name='forms.lowestAlert'></s:text></s:i18n>" selected="true" style="height: 500px">
			<iframe frameborder="0" name="showmessage"
				src="freightPriceAnalyseAlertConfigAction!toJsp.action"></iframe>
		</div>
		<div title="<s:i18n name='forms'><s:text name='forms.cabinAlert'></s:text></s:i18n>"  style="height: 500px">
			<iframe frameborder="0" name="showmessage"
				src="freightPriceAnalyseAlertConfigAction!toCabinChangeAddJsp.action"></iframe>
		</div>
		<div title="<s:i18n name='forms'><s:text name='forms.spreadAlert'></s:text></s:i18n>"  style="height: 500px">
			<iframe frameborder="0" name="showmessage"
				src="freightPriceAnalyseAlertConfigAction!toSpreadAlertAddJsp.action"></iframe>
		</div>
		<div title="<s:i18n name='forms'><s:text name='forms.competitionAlert'></s:text></s:i18n>" style="height: 500px">
			<iframe frameborder="0" name="showmessage"
				src="freightPriceAnalyseAlertConfigAction!toCompeteContrastAlertAddJsp.action"></iframe>
		</div>
	</div>


</body>
<%-- <script >
function saveConfig(){
	//让原本隐藏起来的div显示出来
	//document.getElementById("save").style.display="block";
	var flightFrom = $("#_flightFrom").val();
	var flightTo = $("#_flightTo").val();
	if(flightFrom=="" || flightTo =="" || flightFrom=="中文/拼音" || flightTo =="中文/拼音"){
		alert("航段不能为空");
		return;
	}
	
	//alert(flightFrom);
	//alert(flightTo);
	if(flightFrom==flightTo){
		alert("出发地与目的地不能相同");
		return ;
	}
	var effectiveFrom = $("#_effectiveFrom").val();
	var effectiveTo   = $("#_effectiveTo").val();
	var s_date = new Date(effectiveFrom.replace(/-/g,"/"));
    var e_date = new Date(effectiveTo.replace(/-/g,"/"));
    var alertWay = $("#_alertWay").val();
    
    //未来天数为正整数
    var futureDays = $("#_futureDays").val();
    var triggerCondition = $("#_triggerCondition").val();
    if(futureDays==null||$.trim(futureDays)==''||triggerCondition==null||$.trim(triggerCondition)==''){
    	alert('触发条件未填写');
    	return false;
    }
    
    if(!(/(^[1-9]\d*$)/.test(futureDays))){
    	alert("天数不为正整数");
    	$("#_futureDays").val('');
    	return false;
    }
    
    if(parseInt(futureDays)>30||parseInt(futureDays)<1){
    	alert("未来天数范围1~30");
    	return false;
    }
    
    //触发 条件 天数为正整数
    if(!(/(^[1-9]\d*$)/.test(triggerCondition))){
    	alert("天数不为正整数");
    	$("#_triggerCondition").val('');
    	return false;
    }
    if(futureDays!=null&&triggerCondition!=null){
    	var conditionTime=parseInt(triggerCondition);//触发时间
    	var futureTime=parseInt(futureDays);
    	if((futureTime+1)<conditionTime&&conditionTime>1){
    		alert("触发条件可填的最大值为未来天数+1，最小数为1");
    		return false;
    	};
    }
    
    var time1 = s_date.getTime();
	var time2 = e_date.getTime();
	if(effectiveFrom==""||effectiveTo==""||alertWay==""||futureDays==""||triggerCondition==""){
		alert("有内容未填");
		return;
	}
	if(time1>time2){
		alert("结束时间不能小于开始时间");
		return;
	}
	
	$.post('freightPriceAnalyseAlertConfigAction!saveFreightPriceAnalyseAlertConfig.action',
				$("#formSave").serialize(),
				function(data){
			if(data && data=="succes"){
				alert('保存成功');
				window.returnValue = "ok";
				window.close();
			}else{
				alert('保存失败!\n原因：'+data);
			}
	},'text');
}	


function resetForm(){
	
	
	//var now = new Date(); //或全今天的日期-显示为日期和时间
	//now.setTime(now.getTime()+24*60*60*1000);
	//var dateValue=now.getFullYear() + "-"+ (now.getMonth()+1)+"-"+(now.getDate()); //获取年月日

	//$("#_effectiveFrom").val(dateValue);
	//$("#_effectiveTo").val(dateValue);
	
	//$("#_flightFrom").val("中文/拼音");
	//$("#_flightTo").val("中文/拼音");
	
	//$("#_triggerCondition").val('');
	//$("#_futureDays").val('');
	
	
	$("#_effectiveFrom").val("");
	$("#_effectiveTo").val("");
	
	$("#_flightFrom").val("");
	$("#_flightTo").val("");
	
	$("#_triggerCondition").val('');
	$("#_futureDays").val('');
	
}

function getBack(){
	//让原本隐藏起来的div显示出来
	document.getElementById("save").style.display="none";
}

$(function(){
	var now = new Date(); //或全今天的日期-显示为日期和时间
	var now = new Date(); //或全今天的日期-显示为日期和时间
	now.setTime(now.getTime()+24*60*60*1000);
	var dateValue=now.getFullYear() + "-"+ (now.getMonth()+1)+"-"+(now.getDate()); //获取年月日

	$("#_effectiveFrom").val(dateValue);
	$("#_effectiveTo").val(dateValue);
	
	$('#flightFrom').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	$('#flightTo').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	
	$('#_flightFrom').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	$('#_flightTo').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	
	$('#flightFrom0').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	$('#flightTo0').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	
	
	
	$("#_flightFrom").css({
		"color":"black"
	});
	$("#_flightTo").css({
		"color":"black"
	});
});
function closeWindow(){
	if(window.confirm("您确定要关闭当前窗口吗?")){
		window.close();
	}
}
 // 

//离开页面事件
$(window).unload(function (){
	if(window._save==true){
		var parentWindow = window.dialogArguments;//父窗口
		parentWindow.location.href = parentWindow.location.href
	}
//window.opener.location.href = window.opener.location.href;
});
</script>
<body>
	<!-- 增加  -->
	<div id="save">
		<form id="formSave"   method="post"  target="_parent"  autocomplete="off">
			<input type="hidden" id="id" name="id" value="${id}"/>
			<TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 class="tabg">
					<TR class="tr1">
						<TD colspan="10" style="color:white">运价预警配置</TD>
					</TR>
					<TR class="tab" >
						<TD width="100" height="100" style="text-align: left" class="td1">
							说&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;明：</TD>
						<TD colspan="3">1、带红色 <font color="red">&nbsp;&nbsp;&nbsp;&nbsp;*</font>号的为必填项:<br/>
							2、用户在设置运价预警规则后，当运价差额比例符合指定触发条件时，系统自动发消息(邮件/短信)给制定该规则的用户；<br/>
							3、同一航空公司下相同航线有且只有一条航线预警配置。<br/>
							4、用户预警方式中，目前只支持邮件提醒。<br/>
						</TD>
					</TR>
					
				<TR class="tab">
					<TD width="100" height="26" class="left" style="text-align:left">
						航空公司：
				    	<span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;*</span>
				    </TD>
				    <TD colspan="3">
				     &nbsp;&nbsp;&nbsp;&nbsp;
				       <select class="easyui-combobox" name="airCompany" style="width: 150px;" id="_airCompany">
								<c:choose>
									<c:when test="${tempList == null}">
									</c:when>
									<c:otherwise>
										<c:forEach var="item" items="${tempList}">
											<option>${item.name}</option>
										</c:forEach>
									</c:otherwise>
								</c:choose>
						</select>
				    </TD>
			    </TR>
			    
			    <TR class="tab">
				    <TD width="100" class="td1" style="text-align:left">航&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;段：
				    <font color="red">&nbsp;&nbsp;&nbsp;&nbsp;*</font>
				    </TD>
				    <TD colspan="3">
				      <span>从</span>
				      <input type="text" style="width:100px" name="flightFrom" id="_flightFrom" value="">
				      <span>到</span>
				      <input type="text" style="width:100px" name="flightTo" id="_flightTo" value="">&nbsp;&nbsp;&nbsp;
				    </TD>
			  	</TR>
			  	
			  <TR class="tab">
				  	<TD width="100" height="26" class="left" style="text-align:left">预警方式：
				  	<span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;*</span>
				    </TD>
				    <TD class="left">
				    	 &nbsp;&nbsp;&nbsp;&nbsp;
				      	<select class="easyui-combobox" name="alertWay" style="width: 150px;" id="_alertWay" disabled="disabled">
								<option value="1" selected="selected">邮件</option>
								<option value="0">短信</option>
						</select>
				    </TD>
				    <TD colspan="2" height="26" style="text-align:left">
				    		未来天数：
				    		 <span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;*</span>
				    		 <input type="text" style="width:100px" name="futureDays" id="_futureDays" value="">
				    		 天
				    </TD>
				    <!-- <TD >
				      <input type="text" style="width:100px" name="futureDays" id="_futureDays" value="">
				    </TD> -->
			  </TR>
			  
			  <TR class="tab">
				    <TD width="100" height="26" class="td1" style="text-align:left" >预警有效期：
				          <font color="red">*</font>
				    </TD>
				    <TD colspan="3">
				      <span>从</span>
				      <input type="text" style="width:80px" id="_effectiveFrom" name="effectiveFrom" value="" 
				      	onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'%y-%M-{%d+1}'});" readonly="readonly">
				      <span>到</span>
				      <input type="text" style="width:80px" id="_effectiveTo" name="effectiveTo" value="" 
				      	onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'%y-%M-{%d+1}'});" readonly="readonly">
					</TD>
			  </TR>
			  
			  <TR class="tab">
			  	<TD width="100" height="26" class="left" style="text-align:left">
			  			触发条件：<span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span>
			    </TD>
			    <TD colspan="2" height="26" style="text-align:left">
			    			该航线在未来
				    		 <input type="text" style="width:50px" name="futureDays" id="_futureDays" value="">
							天的价格有 
							<input type="text" style="width:50px" name="triggerCondition" id="_triggerCondition" value="">
							天以
							<select class="easyui-combobox" name="chooseUpOrdown" id="up_down" disabled="disabled">
								<option value="0" selected="selected">下</option>
								<option value="1" >上</option>
							</select>
							是最低价
				</TD>
			    <!-- <TD colspan="3"  height="26">
			    		当天抓抓取到的航线未来各天的各最低价中，我航少于
			    		<input type="text" style="width:100px" name="triggerCondition" id="_triggerCondition" value="">天
			    </TD> -->
			    <!-- <TD >
			      <input type="text" style="width:100px" name="triggerCondition" id="_triggerCondition" value="">天
			    </TD> -->
			  </TR>
			    
			  <TR align="center" class="tab">
			  		<TD colspan="4">
			  			 <input type="button" style="width:80px" id="btnSave" name="btnSave" value="保存" onclick="saveConfig()" />
			  			 <input type="button" style="width:80px" id="btnReset" name="btnReset" value="清空" onclick="resetForm()"/>
			  			 <input type="button" style="width:80px" id="btnClose" name="btnClose" value="关闭" onclick="closeWindow();" /> 
			  		</TD>
			  </TR>
			</table>
		</form>
	</div>
</body> --%>
</html>